import APIClient from "../network/index"
//商品详情请求
const detailsModule = {
    state: {
        detailsItems: []
    },
    mutations: {
        getDetailsList(state, items) {
            state.detailsItems = items;
        }
    },
    actions: {
        getDetailsList(context, id) {
            APIClient.getGoodsDetails({
                params: {
                    id
                }
            })
                .then(res => {
                    //检测
                    // console.log(res.data.data.data.imgs.split(","));
                    res.data.data.data.imgs = res.data.data.data.imgs.split(",");
                    res.data.data.data.detailPics = res.data.data.data.detailPics.split(",");
                    //赋值
                    context.commit("getDetailsList", res.data.data.data);
                })
                .catch(error => {
                    console.log(error);
                });
        }
    },
    modules: {

    }
}
export default detailsModule